# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.IAM.V2.Model.GoogleIamV2Policy do
  @moduledoc """
  Data for an IAM policy.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - A key-value map to store arbitrary metadata for the `Policy`. Keys can be up to 63 characters. Values can be up to 255 characters.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the `Policy` was created.
  *   `deleteTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - A user-specified description of the `Policy`. This value can be up to 63 characters.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - An opaque tag that identifies the current version of the `Policy`. IAM uses this value to help manage concurrent updates, so they do not cause one update to be overwritten by another. If this field is present in a CreatePolicyRequest, the value is ignored.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. The resource name of the `Policy`, which must be unique. Format: `policies/{attachment_point}/denypolicies/{policy_id}` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, requests can use the alphanumeric or the numeric ID. Responses always contain the numeric ID.
  *   `rules` (*type:* `list(GoogleApi.IAM.V2.Model.GoogleIamV2PolicyRule.t)`, *default:* `nil`) - A list of rules that specify the behavior of the `Policy`. All of the rules should be of the `kind` specified in the `Policy`.
  *   `uid` (*type:* `String.t`, *default:* `nil`) - Immutable. The globally unique ID of the `Policy`. Assigned automatically when the `Policy` is created.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the `Policy` was last updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :createTime => DateTime.t() | nil,
          :deleteTime => DateTime.t() | nil,
          :displayName => String.t() | nil,
          :etag => String.t() | nil,
          :kind => String.t() | nil,
          :name => String.t() | nil,
          :rules => list(GoogleApi.IAM.V2.Model.GoogleIamV2PolicyRule.t()) | nil,
          :uid => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:annotations, type: :map)
  field(:createTime, as: DateTime)
  field(:deleteTime, as: DateTime)
  field(:displayName)
  field(:etag)
  field(:kind)
  field(:name)
  field(:rules, as: GoogleApi.IAM.V2.Model.GoogleIamV2PolicyRule, type: :list)
  field(:uid)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.IAM.V2.Model.GoogleIamV2Policy do
  def decode(value, options) do
    GoogleApi.IAM.V2.Model.GoogleIamV2Policy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.IAM.V2.Model.GoogleIamV2Policy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
